import tkinter as tk
from tkinter import ttk
from src.ui.tkinter.styles.colors import BACKGROUND_MAIN

def show_launch_screen(parent: tk.Tk, items: dict) -> None:
    """Clear the parent window and display the startup page (welcome page)"""
    for widget in parent.winfo_children():
        widget.destroy()

    title_label = ttk.Label(
        parent,
        text="TFboys' Bakery",
        style="Title.TLabel"
    )
    title_label.pack(pady=(80, 20))

    item_count = len(items)
    count_label = ttk.Label(
        parent,
        text=f"Items: {item_count}",
        style="Main.TLabel"
    )
    count_label.pack(pady=10)

    def go_to_selection_screen():
        from src.ui.tkinter.screens.selection_screen import show_selection_screen
        show_selection_screen(parent, items)

    enter_btn = ttk.Button(
        parent,
        text="Enter Bread Management",
        style="Normal.TButton",
        command=go_to_selection_screen
    )
    enter_btn.pack(pady=(60, 20))

    tip_label = ttk.Label(
        parent,
        text="Click to manage your magic breads",
        style="Main.TLabel",
        font=("Arial", 10, "italic")
    )
    tip_label.pack(side=tk.BOTTOM, pady=20)